//
//  AppDelegate.m
//  Iderun
//
//  Created by Zhou, Shaolin on 6/10/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

//http://lrb888.vicp.cc:809/
//http://www.51able.com/labs/eoliphoneclient

#import "AppDelegate.h"
#import "LoginViewController.h"
#import "CustomNavigationController.h"

//#import "MasterViewController.h"

@implementation AppDelegate

@synthesize window = _window,tabbar;

//我已审批  待我审批  公司公告 和关于

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 
    UIWindow *window_=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window=window_;
    [window_  release];

      [self popLoginViewController];
    
    [self.window makeKeyAndVisible];
    return YES;
}

-(void) popLoginViewController{
     if ([[NSUserDefaults standardUserDefaults] objectForKey:@"USER_ID"]==nil) {
        LoginViewController * loginViewController=[[LoginViewController alloc] initWithNibName:@"LoginViewControllerPad" bundle:nil];
        ;
        CustomNavigationController *nav=[[CustomNavigationController alloc] initWithRootViewController:loginViewController];
         [loginViewController release];
        self.window.rootViewController = nav;
         [nav  release];
    }else{
        CustonTabbarViewController *custonTabbarViewController=[[CustonTabbarViewController alloc] initWithNibName:nil bundle:nil];
        self.tabbar=custonTabbarViewController;
        [custonTabbarViewController release];
        self.window.rootViewController = self.tabbar;
        self.tabbar.selectedIndex=0;
    }
    
}
- (void)dealloc{
    [_window release];
    [tabbar release];
    [super dealloc];
}

@end
